package casa.depesos.app.com.activity;

import android.os.Bundle;

import androidx.annotation.Nullable;
import androidx.viewpager.widget.ViewPager;

import casa.depesos.app.com.adapter.OrderAdapter;
import casa.depesos.app.com.databinding.ActivityOrdersBinding;
import casa.depesos.app.com.utils.Utils;
import casa.depesos.app.com.view.tab.CustomTabProvider;

public class OrderActivity extends BaseActivity {

    ActivityOrdersBinding binding;

    @Override
    protected boolean needPadding() {
        return false;
    }

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        binding = ActivityOrdersBinding.inflate(getLayoutInflater());
        setContentView(binding.getRoot());
        binding.top.top.setPadding(0, Utils.getStatusBarHeight(this), 0, 0);
        binding.top.back.setOnClickListener(v -> finish());
        binding.top.title.setText("Gestión de pedidos");

        binding.pager.setAdapter(new OrderAdapter(getSupportFragmentManager()));
        binding.pager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
            @Override
            public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {

            }

            @Override
            public void onPageSelected(int position) {

            }

            @Override
            public void onPageScrollStateChanged(int state) {

            }
        });
        binding.tab.setCustomTabView(new CustomTabProvider(this));
        binding.tab.setViewPager(binding.pager);
    }
}
